{% extends "myghtyboard/base.html" %}
{% load i18n %}
{% load fbc %}
{% load pyif %}


{% block extra-title %}{% trans "Forum Index" %} - {{ forum_name }} - {{ topic.name }}{% endblock %}

{% block your-position %}
	<a href="/forum/">{% trans "Forum Index" %}</a>
	<span class="color-orange">»</span>
	<a href='/forum/forum/{{topic.forum.id}}/'>{{ topic.forum.name }}</a>
	<span class="color-orange">»</span>
	<a href="/forum/topic/1/{{ topic.id }}">{{ topic.name }}</a>
{% endblock %}


{% block pagemenu %}
	{% if opened %}
		<li><a href="/forum/add_post/{{ topic.id }}/">{% trans "Add Post" %}</a></li>
	{% endif %}
	<li><a href="/forum/">{% trans "Back to Forum" %}</a></li>
	<li><a href="/forum/lasttopics/">{% trans "Last Active Topics" %}</a></li>
	<li><a href="/forum/mytopics/">{% trans "My Topics" %}</a></li>
	<li><a href="/forum/myptopics/">{% trans "My Posts" %}</a></li>
{% endblock %}

{% block content %}
               <div id="page-container">
                        <!-- Lewa kolumna START -->
                            <!-- Temat -->
{% for post in posts.object_list %}
							<a name="post_{{post.id}}"></a>
                            <div class="box-shadow">
                                <div class="box">
                                {% if forloop.first %}
                                    <div class="box-header">
                                        <span class="box-header-title">

                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>{{ topic.name }}</span>
                                        </span>
                                    </div>
                                {% endif %}
                                    <div class="box-content">                                    
                                        <div class="forum-post">
                                            {{ post.text|fbc|safe|urlizetrunc:"60"  }}
                                            {% comment %}
                                            <br />
                                            <br />

                                            <span class="color-orange">»</span> <strong>Załączniki</strong>
                                            <p class="attachment">
                                                <img alt="attachment" src="/site_media/css/gfx/attachment.gif" /><br />
                                                <span>1280x800, 211 KB</span><br/>
                                                <span>Ściągnięto 21 razy</span>
                                            </p>
											{% endcomment %}
                                        </div>
                                        <hr />
                                        <div class="line">
                                           <span class="button-border"><span class="date{% if post.new %} alert{% endif %} auto-date">{{ post.date|date:"d/m/Y, G:i" }}<br /></span></span>
                                            <span class="content">
                                                <strong>{{ post.author_system }}{% if perms.is_staff %} @{{ post.ip }}{% endif %}</strong><br />

                                            </span>
                                          {% if perms.add_post %}
											{% if opened %}							
                                            <span class="button-border buttons"><span class="button"><a href="/forum/add_post/{{ topic.id }}/{{ post.id }}/">{% trans "Reply with quote" %}</a></span></span>
											{% endif %}
										  {% endif %}           
										{% ifequal post.author_system.username user.username %}
											{% if opened %}
													<span class="button-border buttons"><span class="button"><a href="/forum/edit_post/{{ post.id }}/">{% trans "Edit this post" %}</a></span></span>
											{% endif %}
										{% else %}
											{% if perms.is_staff %}
												<span class="button-border buttons"><span class="button"><a href="/forum/edit_post/{{ post.id }}/">{% trans "Edit this post" %}</a></span></span>
											{% endif %}
										{% endifequal %}
										{% if perms.is_staff %}
											<span class="button-border buttons"><span class="button"><a href="/forum/delete_post/{{ post.id }}/{{ topic.id }}/" onclick="return confirm('{% trans "Delete This Post?" %}')">{% trans "Delete this post" %}</a></span></span>
										{% endif %}										                               
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- Temat Koniec -->
{% endfor %}

<div class="box-shadow">
<div class="box">
<div class="box-content">
<strong>{% trans "Pages: " %}</strong>
{% for i in cnt %}	
	[<a href="/forum/topic/{{ i }}/{{ topic.id }}/">{% ifequal i.__str__ page.__str__ %}<b><span class="color-orange">{{ i }}</span></b>{% else %}{{ i }}{% endifequal %}</a>]
{% endfor %}
</div>
</div>
</div>

{% if perms.add_post %}
	{% if opened %}
                            <div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Szybka riposta</span>
                                        </span>
                                    </div>
                                    <div class="box-content">
                                        <form method="post" action="/forum/add_post/{{ topic.id }}/" enctype="">

                                            <fieldset>
                                                <textarea class="height-60" name="text">{{ text }}</textarea>
                                                <strong>{% trans "Available Tags" %}</strong>: [b], [u], [i], [code]. [url], [img], [quote].
                                                    <p class="right">
                                                        <span class="button-border">
                                                            <input type="submit" name="save" value="{% trans "Add post" %}" />
                                                        </span>
                                                    </p>
                                            </fieldset>

                                        </form>
                                    </div>
                                </div>
                            </div>
	{% endif %}
{% endif %}
                        <!-- Lewa kolumna KONIEC -->
                </div>
                
                
                <div id="page-container-2">
                        <!-- Prawa kolumna START -->
                            <div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Uprawnienia</span>
                                        </span>
                                        <span class="box-header-icons">
                                            <img class="box-header-minimize" alt="minimize" src="/site_media/css/gfx/icons/minimize-transparent.png" />
                                            <img class="box-header-close" alt="close" src="/site_media/css/gfx/icons/close-transparent.png" />
                                        </span>
                                    </div>
                                    <div class="box-content">
                                        <p class="line">
						{% if perms.add_topic %}
							<span class="color-orange">{% trans "You <b>can</b> post new Topics" %}</span><br />
						{% else %}
							<span class="color-grey">{% trans "You <b>can't</b> post new Topics" %}</span><br />
						{% endif %}
						{% if perms.add_post %}
							<span class="color-orange">{% trans "You <b>can</b> post new Posts" %}</span><br />
						{% else %}
							<span class="color-grey">{% trans "You <b>can't</b> post new Posts" %}</span><br />
						{% endif %}
						<hr/>
						{% if perms.is_staff %}
							<span class="color-orange">{% trans "You <b>are</b> a Moderator" %}</span><br />
						{% else %}
							<span class="color-grey">{% trans "You <b>aren't</b> a moderator" %}</span><br />
						{% endif %}
                                        </p>                                        
                                    </div>
                                </div>
                            </div>
                            <!-- Opcje -->
			<div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Opcje</span>
                                        </span>
                                        <span class="box-header-icons">
                                            <img class="box-header-minimize" alt="minimize" src="/site_media/css/gfx/icons/minimize-transparent.png" />
                                            <img class="box-header-close" alt="close" src="/site_media/css/gfx/icons/close-transparent.png" />
                                        </span>
                                    </div>
                                    <div class="box-content">
                                        <p class="line">
                                			<span class="content">
                                				<span class="button-border"><span class="button"><a href="/forum/add_post/{{ topic.id }}/">Odpowiedz</a></span></span>
                        					</span>
                                        </p>
										<hr/>
										<p class="line">
											<span class="content">
												<span class="button"><a href="/forum/add_topic/{{ topic.forum.id }}/">{% trans "Dodaj nowy temat" %}</a></span>
										    </span>
										</p>
                                    </div>
                                </div>
                            </div>
                            <!-- KONIEC Opcje -->
                            <!-- Ostatnie tematy -->
                           <div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Najnowsze tematy na tym forum</span>
                                        </span>
                                        <span class="box-header-icons">
                                            <img class="box-header-minimize" alt="minimize" src="/site_media/css/gfx/icons/minimize-transparent.png" />
                                            <img class="box-header-close" alt="close" src="/site_media/css/gfx/icons/close-transparent.png" />
                                        </span>
                                    </div>
                                    <div class="box-content">
				    {% for topic in hot_topics %}
                                        <p class="line">
                                            <span class="content">
                                                <strong class="tag-normal"><a href="/forum/topic/1/{{ topic.id }}">{{ topic.name }}</a></strong><br />
                                                <span class="color-gray">{{ topic.forum.category.name }}</span> <span class="color-orange">»</span> <span class="color-gray"><a href="/forum/forum/{{ topic.forum.id }}">{{ topic.forum.name }}</a></span>
                                            </span>
                                            <span class="icons">
                                                <a href="/forum/topic/{{ topic.forum.id }}/{{ topic.id }}"><img class="icon-show" alt="show" src="/site_media/css/gfx/icons/show-white.gif" /></a>
                                            </span>
                                        </p>
					{% if not forloop.last %}
                                        <hr />
					{% endif %}
				    {% endfor %}
                                    </div>
                                </div>
                            </div>
                            <!-- Ostatnie tematy KONIEC -->
                            <!-- Prawa kolumna KONIEC -->
                </div>
            
{% endblock %}


